/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.wicket.examples;

import com.myapp.wicket.BaseExamplesPage;
import com.myapp.wicket.data.MockDataBaseDAO.Country;
import com.myapp.wicket.interfaces.CountryDataProviderExample;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;

/**
 *
 * @author Jeff
 */
public final class DataProviderExamplePage extends BaseExamplesPage {

    public DataProviderExamplePage() {
        super();

        DataView<Country> countriesDataView = new DataView<Country>("countries", new CountryDataProviderExample()) {

            @Override
            protected void populateItem(Item<Country> item) {
                final WebMarkupContainer webMarkupContainer = new WebMarkupContainer("country");
                item.add(webMarkupContainer);
                webMarkupContainer.add(new Label("name", item.getModelObject().getCountryOrAreaName()));
                webMarkupContainer.add(new Label("abbrev", item.getModelObject().getIsoAlpha3Code()));
            }
        };
        
        add(countriesDataView);
    }
    
    protected DataProviderExamplePage(PageParameters params) {
        //TODO:  process page parameters
    }
}
